import { Controller, Post, Body } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { AppService } from './app.service';
import { ApiResponse as ApiResponseDto } from './common/dto/response.dto';

@ApiTags('系统')
@Controller('system')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Post('welcome')
  @ApiOperation({
    summary: '系统首页',
    description: '获取系统首页欢迎信息'
  })
  @ApiResponse({
    status: 200,
    description: '欢迎信息'
  })
  getHello() {
    const message = this.appService.getHello();
    return ApiResponseDto.success({ message }, '欢迎访问');
  }

  @Post('health')
  @ApiOperation({
    summary: '健康检查',
    description: '检查服务运行状态'
  })
  @ApiResponse({
    status: 200,
    description: '服务运行正常'
  })
  getHealth() {
    const healthData = {
      status: 'ok',
      timestamp: new Date().toISOString(),
      message: '服务运行正常'
    };
    return ApiResponseDto.success(healthData, '健康检查通过');
  }
}
